package com.audaque.springboot.foshanupload.druid.config;

import com.alibaba.druid.support.http.StatViewServlet;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author caoyn
 * @date 2020/4/9
 */
//druid监控页面是一个servlet，需要让SpingBoot支持servlet
@Slf4j
@Configuration
@ConditionalOnProperty(value = "switch.druid", havingValue = "true", matchIfMissing = false)
public class DruidConfig {
    /**
     * 数据库连接池监控页面插件配置方式2
     * @description 注册一个StatViewServlet, 进行druid监控页面配置
     */
   /* @Bean
    public ServletRegistrationBean druidStatViewServlet() {
        //先配置管理后台的servLet，访问的入口为/druidManager/
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
                new StatViewServlet(), "/druidManager/*");
        servletRegistrationBean.addInitParameter("loginUsername", "admin");
        servletRegistrationBean.addInitParameter("loginPassword", "root");
        servletRegistrationBean.addInitParameter("resetEnable", "false");
        return servletRegistrationBean;
    }
*/
}
